package seunit.framework.automation;
import java.sql.*;

public class MyConnection {

	static 
    {
        try  { 
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        } 
        catch (Exception e) {
            System.err.println(e);
        }
    }
	public static void connect(String fileName){
		Connection conn=null;
        Statement stmt=null;
        String sql="";
        ResultSet rs=null;
 
        try {
            conn=DriverManager.getConnection("jdbc:odbc:fileName","","");
            stmt=conn.createStatement();
            sql="select * from [Sheet1$]";
            rs=stmt.executeQuery(sql);

            while(rs.next()){
                System.out.println(rs.getString("USERID")+
                  " "+ rs.getString("FIRST_NAME")+" "+ 
                  rs.getString("LAST_NAME"));
            }
        } 
        catch (Exception e){
            System.err.println(e);
        } 
        finally {
            try{
                rs.close();
                stmt.close();
                conn.close();
                rs=null;
                stmt=null;
                conn=null; 
            }
            catch(Exception e){}
        }

	}
}
